package com.xuecheng.media.task;

import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;

/**
 * @author yellow Doctor
 * @date 2025-11-20
 * @desc https://blog.csdn.net/hekai7217
 */
public class Demo03 {

    public static void main(String [] agrs){

        //线程池 中的定时任务
        ScheduledExecutorService service = Executors.newScheduledThreadPool(10);
        service.scheduleAtFixedRate(
                new Runnable() {
                    @Override
                    public void run() {
                        //TODO：something
                        System.out.println("todo something");
                    }
                }, 1,
                2, TimeUnit.SECONDS);
    }

}
